package com.voxel.sense.infomsg.widget.adapter;

import android.graphics.Color;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.com.common.view.recycler.RecyclerAdapter;
import com.voxel.sense.infomsg.R;
import com.voxel.sense.infomsg.data.bean.ConditionBean;
import com.voxel.sense.infomsg.utils.GlideUtils;

/**
 * Created by chenyiyao on 2017/11/3.
 */

public class FilterSuperviseRecyclerAdapter extends AbsPickRecyclerAdapter {





    public FilterSuperviseRecyclerAdapter(AdapterListener<ConditionBean> listener) {
        super(listener);
    }

    @Override
    protected int getItemViewType(int position, ConditionBean conditionBean) {
        return R.layout.item_recycler_drop_down_supervise;
    }

    @Override
    protected ViewHolder<ConditionBean> onCreateViewHolder(View root, int viewType) {
        return new ItemViewHolder(root);
    }

    @Override
    public void onBindViewHolder(final ViewHolder<ConditionBean> holder, final int position) {
        super.onBindViewHolder(holder, position);
    }

    @Override
    protected boolean handlerSatu(ConditionBean conditionBean) {
        return true;
    }

    static class ItemViewHolder extends RecyclerAdapter.ViewHolder<ConditionBean> {

        TextView mText;
        ImageView iv_icon_super;
        View ll_root;
        View root;

        public ItemViewHolder(View itemView) {
            super(itemView);
            root = itemView;
            this.mText = root.findViewById(R.id.tv_text_menu);
            this.iv_icon_super = root.findViewById(R.id.iv_icon_super);
            this.ll_root = root.findViewById(R.id.ll_root);
        }

        @Override
        protected void onBind(ConditionBean bean) {
            if (bean.isSelect()) {
                mText.setTextColor(Color.WHITE);
                ll_root.setSelected(true);
            } else {
                ll_root.setSelected(false);
                mText.setTextColor(0xff666466);
            }

            mText.setText(bean.getDesc());
//            if (!TextUtils.isEmpty(bean.getUrl())) {
//                GlideUtils.GlideLoadConfigPNGIcon(root.getContext(), bean.getUrl(), iv_icon_super);
//            }
        }
    }
}
